﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IDAL;
using DAL;
using Models;

namespace BLL
{
    public class ServiceInfoLogic
    {
        public static IServiceInfo serviceinfo = new ServiceInfoDAL();

        public static List<ServiceInfo> GetCategoryServiceInfo(int CategoryID, int pagesize, int nowpage)
        {
            List<ServiceInfo> list = serviceinfo.GetCategoryServiceInfo(CategoryID,pagesize,nowpage);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].ShowID = i + 1 + (nowpage - 1) * pagesize;

                if (list[i].ServiceURL != "")
                {
                    list[i].ServiceURL = "href= \""+list[i].ServiceURL+"\"";
                }
            }
            return list;
        }

        public static int GetPageCount(int pagesize,int CategoryID)
        {
            return serviceinfo.GetPageCount(pagesize,CategoryID);
        }
        public static int AddServiceInfo(ServiceInfo ser)
        {
            return serviceinfo.AddServiceInfo(ser);
        }
        public static ServiceInfo GetOneServiceInfo(int ServiceID)
        {
            return serviceinfo.GetOneServiceInfo(ServiceID);
        }
        public static int UpdateServiceInfo(ServiceInfo ser)
        {
            return serviceinfo.UpdateServiceInfo(ser);
        }
        public static int DeleteServiceInfo(int ServiceID)
        {
            return serviceinfo.DeleteServiceInfo(ServiceID);
        }
    }
}
